#include <iostream>
using namespace std;
#include <vector>


class Solution {
public:
    void pile(vector<int>& nums, int n, int p)
    {
        int parent = p;
        int child = parent * 2 + 1;
        while (child < n)
        {
            if (child + 1 < n && nums[child + 1] > nums[child])
            {
                child++;
            }
            if (nums[child] > nums[parent])
            {
                swap(nums[child], nums[parent]);
                parent = child;
                child = parent * 2 + 1;
            }
            else
            {
                break;
            }
        }
    }
    int findKthLargest(vector<int>& nums, int k) {
        int n = nums.size();
        for (int i = (n - 1 - 1) / 2; i >= 0; i--)
        {
            pile(nums, n, i);
        }
        int end = n - 1;
        while (k--)
        {
            swap(nums[0], nums[end]);
            pile(nums, end, 0);
            end--;
        }
        return nums[end + 1];
    }
};

int main()
{
    vector<int> p = { 2,1 };
    Solution s;
    cout << s.findKthLargest(p, 1) << endl;
    return 0;
}

#include <stdio.h>

int main() {
    char arr1[10000] = { 0 };
    char arr2[10000] = { 0 };
    gets(arr1);
    gets(arr2);
    char arr3[10000] = { 0 };
    int arr4[300] = { 0 };
    int i = 0;
    while (arr2[i])
    {
        arr4[arr2[i]]++;
        i++;
    }
    i = 0;
    int k = 0;
    while (arr1[i])
    {
        if (arr4[arr1[i]] == 0)
        {
            arr3[k++] = arr1[i];
        }
        i++;
    }
    printf("%s\n", arr3);
    return 0;
}

int main() {
    int a = 0;
    cin >> a;
    int sum = 0;
    int n = a * 3;
    int i = 0;
    vector<int> ret;
    while (i < n)
    {
        int p = 0;
        cin >> p;
        ret.push_back(p);
        i++;
    }
    sort(ret.begin(), ret.end());
    int left = 0;
    int right = n - 1;
    while (left < right)
    {
        left++;
        right--;
        sum += ret[right--];
    }
    cout << sum << endl;
    return 0;
}